export enum ColliderEvents {
    TRIGGER_START = 'TRIGGER_START',
    TRIGGER_STAY = 'TRIGGER_STAY',
    TRIGGER_EXIT = 'TRIGGER_EXIT',
    COLLIDE_START = 'COLLIDE_START',
    COLLIDE_STAY = 'COLLIDE_STAY',
    COLLIDE_EXIT = 'COLLIDE_EXIT',
}

export default class ColliderTrigger extends Laya.Script3D {
    eventer = new Laya.EventDispatcher();

    public onTriggerEnter(other: Laya.PhysicsComponent): void {
        this.eventer.event(ColliderEvents.TRIGGER_START, other);
    }

    public onTriggerStay(other: Laya.PhysicsComponent): void {
        this.eventer.event(ColliderEvents.TRIGGER_STAY, other);
    }

    public onTriggerExit(other: Laya.PhysicsComponent): void {
        this.eventer.event(ColliderEvents.TRIGGER_EXIT, other);
    }

    public onCollisionEnter(collision: Laya.Collision) {
        this.eventer.event(ColliderEvents.COLLIDE_START, collision);
    }

    public onCollisionStay(collision: Laya.Collision) {
        this.eventer.event(ColliderEvents.COLLIDE_STAY, collision);
    }

    public onCollisionExit(collision: Laya.Collision) {
        this.eventer.event(ColliderEvents.COLLIDE_EXIT, collision);
    }
}
